BIOMASSA <- read.csv("biodepth/BiodepthSpeciesBiomass.csv", sep = ";", h=T)
Sweden e Sheffield não tem funções de solo medidas & só tem funcoes medidas pra o ano 3 = vou filtrar esses
BIOMASSA <- BIOMASSA %>%
filter(!(site %in% c("Sweden", "Sheffield"))) %>%
filter(year == 3)
###Biomassa relativa
BIOMASSA <- BIOMASSA %>%
group_by(year, site, block, plot) %>%
mutate(percentage_biomass = 100 * biomass / sum(biomass, na.rm = TRUE))
datatable(BIOMASSA, options= list(deferRender = TRUE, scrollY = "350px", scrollX=T, scroller = TRUE, autoWidth=T), rownames=T)
ggplot(BIOMASSA, aes(x = biomass)) +
geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
labs(title = "Biomassa Biodepth",
x = "Biomassa",
y = "Frequência") +
theme_minimal()
ggplot(BIOMASSA, aes(x = percentage_biomass)) +
geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
labs(title = "Biomassa relativa Biodepth",
x = "Biomassa relativa",
y = "Frequência") +
theme_minimal()
## Warning: Removed 16 rows containing non-finite outside the scale range
## (`stat_bin()`).
Passando de biomassa para composição de espécies
COMPOSICAO <- BIOMASSA %>%
group_by(year,location,site,block,plot,sr,fr,fgc,mix.nest,mix,grass,forb,legume,funct,GRASS,FORB,LEG) %>%
pivot_wider(
names_from = species,
values_from = percentage_biomass,
values_fill = list(percentage_biomass=0))
#matrix de abundancia
abundance <- COMPOSICAO %>%
ungroup() %>%
mutate(unique_plot = paste(plot, block, year, site, sep = "_")) %>%
group_by(unique_plot) %>%
summarise(across(where(is.numeric), sum, na.rm = TRUE)) %>%
column_to_rownames(var = "unique_plot") %>%
dplyr::select(-year,-location, -sr, -fr,-fgc, -mix.nest, -mix, -biomass)
# Cria a coluna 'riqueza' contando o número de espécies em cada plot
abundance$riqueza <- rowSums(abundance > 0)
abundance_filtrado <- abundance[abundance$riqueza > 3, ]
abundance_filtrado$riqueza <- NULL
#Remover espécies que não aparecem em nenhum plot
abundance_filtrado <- abundance_filtrado[, colSums(abundance_filtrado, na.rm = TRUE) > 0]
abundance_matrix <- as.matrix(abundance_filtrado)
fd <- dbFD(trait_dat, abundance_matrix)
## FRic: Dimensionality reduction was required. The last 55 PCoA axes (out of 58 in total) were removed.
## FRic: Quality of the reduced-space representation = 0.9651948
Functional <- data.frame(raoq = fd$RaoQ, FRic = fd$FRic,FEve = fd$FEve, FDis = fd$FDis, FD = fd$nbsp )
datatable(Functional, options= list(deferRender = TRUE, scroller = TRUE, scrollX=T, scrollY = "350px", autoWidth=T), rownames=T)
hist(Functional$FRic)
hist(Functional$raoq)
multi <- cbind(dataset_biodep1, getStdAndMeanFunctions(dataset_biodep1, vars))
dataset_final <- multi %>%
left_join(Functional, by = c("plot", "site"))
datatable(dataset_final, options= list(deferRender = TRUE, scroller = TRUE, scrollY = "350px", scrollX=T, autoWidth=T), rownames=T)
cor_matrix
## raoq FRic FEve FDis FD
## raoq 1.00000000 0.2009365 0.32052592 0.9048706 0.05321873
## FRic 0.20093647 1.0000000 0.05216400 0.2040866 0.65791489
## FEve 0.32052592 0.0521640 1.00000000 0.3427071 -0.01657395
## FDis 0.90487060 0.2040866 0.34270710 1.0000000 0.13923123
## FD 0.05321873 0.6579149 -0.01657395 0.1392312 1.00000000
ggcorrplot(cor_matrix,
method = "circle",
type = "lower",
lab = TRUE,
title = "Índices de Diversidade Funcional")
mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|site),data = biodepth[-46,])
summary(mod1)
## Family: gaussian ( identity )
## Formula: meanFunction ~ raoq + FRic + (1 | site)
## Data: biodepth[-46, ]
##
## AIC BIC logLik deviance df.resid
## -206.3 -192.6 108.2 -216.3 110
##
## Random effects:
##
## Conditional model:
## Groups Name Variance Std.Dev.
## site (Intercept) 0.013724 0.11715
## Residual 0.007496 0.08658
## Number of obs: 115, groups: site, 6
##
## Dispersion estimate for gaussian family (sigma^2): 0.0075
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.317e-01 5.379e-02 6.166 7e-10 ***
## raoq -1.427e-03 6.655e-04 -2.145 0.03197 *
## FRic 2.808e-04 9.431e-05 2.978 0.00291 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal
outliers(mod_resid)
## [1] 42
ggplot(biodepth, aes(x = raoq, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
ggplot(biodepth, aes(x = raoq, y = meanFunction, color = as.factor(site))) +
geom_point() +
geom_smooth(aes(group = as.factor(site)), method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
#Tirando países com poucas réplicas (outliers)
biodepth_semot <- biodepth %>%
filter(!site == "Portugal") %>%
filter(!site == "Greece")
mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|site),data = biodepth_semot)
summary(mod1)
## Family: gaussian ( identity )
## Formula: meanFunction ~ raoq + FRic + (1 | site)
## Data: biodepth_semot
##
## AIC BIC logLik deviance df.resid
## -178.6 -165.5 94.3 -188.6 96
##
## Random effects:
##
## Conditional model:
## Groups Name Variance Std.Dev.
## site (Intercept) 0.006752 0.08217
## Residual 0.008007 0.08948
## Number of obs: 101, groups: site, 4
##
## Dispersion estimate for gaussian family (sigma^2): 0.00801
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.3789062 0.0454047 8.345 < 2e-16 ***
## raoq -0.0018652 0.0009956 -1.873 0.06101 .
## FRic 0.0004219 0.0001164 3.624 0.00029 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(biodepth_semot, aes(x = raoq, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
ggplot(biodepth_semot, aes(x = raoq, y = meanFunction, color = as.factor(site))) +
geom_point() +
geom_smooth(aes(group = as.factor(site)), method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
ggplot(biodepth_semot, aes(x = FRic, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "FRic",
x = "FRic", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
ggplot(biodepth_semot, aes(x = FRic, y = meanFunction, color = as.factor(site))) +
geom_point() +
geom_smooth(aes(group = as.factor(site)), method = "lm", se = FALSE) +
labs(title = "FRic",
x = "FRic", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
Avaliar o efeito de diferentes níveis de fertilização com nitrogênio em um experimento de competição de árvores.
9 TRTAMENTOS de adição de nitrogênio:
1: 0g/m²/ano nitrogênio (com micronutrientes)
2: 3g/m²/ano nitrogênio (com micronutrientes)
3: 6g/m²/ano nitrogênio (com micronutrientes)
4: 10g/m²/ano nitrogênio (com micronutrientes)
5: 16g/m²/ano nitrogênio (com micronutrientes)
6: 28g/m²/ano nitrogênio (com micronutrientes)
7: 50g/m²/ano nitrogênio (com micronutrientes)
8: 80g/m²/ano nitrogênio (com micronutrientes)
9: 0g/m²/ano (sem nitrogênio sem micronitrientes)
biomassa <- read.table("e097/e097_Plant aboveground biomass data.txt", h=T, sep="\t")
Filtrando o ano 1982 porque as funções foram coletadas aqui.
biomassa <- biomassa %>%
filter(year=="1982")
Biomassa relativa
biomassa <- biomassa %>%
group_by(Field, plot.number) %>%
mutate(percentage_biomass = 100 * Species.Biomass..g.m2. / sum(Species.Biomass..g.m2., na.rm = TRUE))
datatable(biomassa, options= list(deferRender = TRUE, scrollY = "350px", scrollX=T, scroller = TRUE, autoWidth=T), rownames=T)
ggplot(biomassa, aes(x = percentage_biomass)) +
geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
labs(title = "Biomassa relativa CEDAR CREEK e97",
x = "Biomassa relativa",
y = "Frequência") +
theme_minimal()
###FUNCIONAL
# Cálculo da diversidade funcional
fd <- dbFD(trait_dat, abundance_matrix_clean)
## FRic: Dimensionality reduction was required. The last 60 PCoA axes (out of 64 in total) were removed.
## FRic: Quality of the reduced-space representation = 0.9789017
Functional <- data.frame(raoq = fd$RaoQ, FRic = fd$FRic,FEve = fd$FEve, FDis = fd$FDis, FD = fd$nbsp )
datatable(Functional, options= list(deferRender = TRUE, scrollY = "350px", scrollX=T, scroller = TRUE, autoWidth=T), rownames=T)
#Dataset junto das funções
funcoes <- potassioFunc %>%
full_join(fosforoFunc, by = c("Plot.number", "Field.letter")) %>%
full_join(calcioFunc, by = c("Plot.number", "Field.letter")) %>%
full_join(magnesioFunc, by = c("Plot.number", "Field.letter")) %>%
full_join(nitroFunc, by = c("Plot.number", "Field.letter")) %>%
full_join(phFunc, by = c("Plot.number", "Field.letter"))
e97_multifuncionalidade <- cbind(datset_97, getStdAndMeanFunctions(datset_97, vars))
dataset_final_e97 <- e97_multifuncionalidade %>%
left_join(Functional, by = c("Plot.number", "treatment", "Field.letter"))
datatable(dataset_final_e97, options= list(deferRender = TRUE, scrollY = "350px", scrollX=T, scroller = TRUE, autoWidth=T), rownames=T)
cor_matrix
## raoq FRic FEve FDis FD
## raoq 1.0000000 0.1762663 0.19790931 0.9697383 -0.19715587
## FRic 0.1762663 1.0000000 0.15502712 0.1612947 0.79029689
## FEve 0.1979093 0.1550271 1.00000000 0.3268466 0.04754828
## FDis 0.9697383 0.1612947 0.32684660 1.0000000 -0.18431343
## FD -0.1971559 0.7902969 0.04754828 -0.1843134 1.00000000
ggcorrplot(cor_matrix,
method = "circle",
type = "lower",
lab = TRUE,
title = "Índices de Diversidade Funcional")
mod1 <- glmmTMB(log(meanFunction) ~ raoq + FRic + (1|Field.letter),data = e97)
summary(mod1)
## Family: gaussian ( identity )
## Formula: log(meanFunction) ~ raoq + FRic + (1 | Field.letter)
## Data: e97
##
## AIC BIC logLik deviance df.resid
## -247.4 -234.0 128.7 -257.4 103
##
## Random effects:
##
## Conditional model:
## Groups Name Variance Std.Dev.
## Field.letter (Intercept) 0.008875 0.09421
## Residual 0.004963 0.07045
## Number of obs: 108, groups: Field.letter, 2
##
## Dispersion estimate for gaussian family (sigma^2): 0.00496
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.713e-01 8.333e-02 -4.456 8.36e-06 ***
## raoq -1.744e-03 8.262e-04 -2.111 0.0348 *
## FRic -6.280e-06 5.547e-05 -0.113 0.9099
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal
outliers(mod_resid)
## [1] 26
ggplot(e97, aes(x = raoq, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
ggplot(e97, aes(x = raoq, y = meanFunction, color = as.factor(Field.letter))) +
geom_point() +
geom_smooth(aes(group = as.factor(Field.letter)), method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
#Tirando outliers
e97_semot <- e97 %>%
filter(!raoq <40) %>%
filter(!meanFunction >0.9)
mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|Field.letter),data = e97_semot)
summary(mod1)
## Family: gaussian ( identity )
## Formula: meanFunction ~ raoq + FRic + (1 | Field.letter)
## Data: e97_semot
##
## AIC BIC logLik deviance df.resid
## -365.3 -352.0 187.6 -375.3 101
##
## Random effects:
##
## Conditional model:
## Groups Name Variance Std.Dev.
## Field.letter (Intercept) 0.002786 0.05278
## Residual 0.001558 0.03947
## Number of obs: 106, groups: Field.letter, 2
##
## Dispersion estimate for gaussian family (sigma^2): 0.00156
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 6.475e-01 4.952e-02 13.076 <2e-16 ***
## raoq -5.073e-04 5.304e-04 -0.956 0.339
## FRic 1.815e-05 3.150e-05 0.576 0.564
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(e97_semot, aes(x = raoq, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
ggplot(e97_semot, aes(x = raoq, y = meanFunction, color = as.factor(Field.letter))) +
geom_point() +
geom_smooth(aes(group = as.factor(Field.letter)), method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
ggplot(biodepth_semot, aes(x = FRic, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "FRic",
x = "FRic", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
Biodiversity II, effects od plant biodiversity on population and ecossystem process
168 parcelas de 9m x 9m.
Tratamentos: Parcelas com 1, 2, 4, 8 ou 16 espécies de plantas, com cerca de 30 réplicas para cada nível de diversidade.
datatable(cover, options= list(deferRender = TRUE, scrollY = "350px", scrollX=T, scroller = TRUE, autoWidth=T), rownames=T)
# Calcular a cobertura relativa por quadrante dentro de cada plot
cover <- cover %>%
group_by(Year, Plot, Quadrat) %>%
mutate(percentage_cover = 100 * Abscover / sum(Abscover, na.rm = TRUE))
# Somar a cobertura por espécie dentro de cada plot e ano
cover <- cover %>%
group_by(Year, Plot, Species) %>%
summarize(Total_Abscover = sum(percentage_cover, na.rm = TRUE)) %>%
ungroup()
## `summarise()` has grouped output by 'Year', 'Plot'. You can override using the
## `.groups` argument.
# Padronizar para que a soma total seja 100% dentro de cada plot
cover <- cover %>%
group_by(Year, Plot) %>%
mutate(cover_final = 100 * Total_Abscover / sum(Total_Abscover, na.rm = TRUE)) %>%
ungroup()
ggplot(cover, aes(x = Total_Abscover)) +
geom_histogram(bins = 50, fill = "blue", color = "black")
ggplot(cover, aes(x = cover_final)) +
geom_histogram(bins = 50, fill = "blue", color = "black")
fd_120 <- dbFD(trait_dat_120, abundance_120_matrix_clean)
## FEVe: Could not be calculated for communities with <3 functionally singular species.
## FDis: Equals 0 in communities with only one functionally singular species.
## FRic: To respect s > t, FRic could not be calculated for communities with <3 functionally singular species.
## FRic: Dimensionality reduction was required. The last 75 PCoA axes (out of 77 in total) were removed.
## FRic: Quality of the reduced-space representation = 0.9697847
## FDiv: Could not be calculated for communities with <3 functionally singular species.
Functional_120 <- data.frame(raoq = fd_120$RaoQ, FRic = fd_120$FRic,FEve = fd_120$FEve, FDis = fd_120$FDis, FD = fd_120$nbsp )
hist(Functional_120$raoq)
hist(Functional_120$FRic)
#quantidades de amostragem tudo diferente nos anos
#carbon_nitroFunc 1164
#biomassaFunc 1862
#soil_carbonFunc 726
#nitrat_amoniFunc 1194
#soil_nitroFunc 726
data_list <- list(carbon_nitroFunc, biomassaFunc, soil_carbonFunc, nitrat_amoniFunc, soil_nitroFunc)
combined_data <- reduce(data_list, full_join, by = c("Year", "Plot"))
#remover todos os dados ausentes
#so sobra 1996 e 2000
funcoes_120 <- na.omit(combined_data)
e120_multifuncionalidade <- cbind(dataset_120, getStdAndMeanFunctions(dataset_120, vars120))
dataset_final_120 <- e120_multifuncionalidade %>%
left_join(Functional_120, by = c("Plot", "Year"))
datatable(dataset_final_120, options= list(deferRender = TRUE, scrollY = "350px", scrollX=T, scroller = TRUE, autoWidth=T), rownames=T)
#Vou apenas cortar
##Help####
#dataset_final_120 <- dataset_final_120 %>%
# filter(FDis < 10, raoq < 50, FRic < 200)
cor_matrix
## raoq FRic FEve FDis FD
## raoq 1.00000000 0.5399637 0.06790921 0.92800700 -0.06443103
## FRic 0.53996375 1.0000000 -0.14027663 0.49216401 0.22802462
## FEve 0.06790921 -0.1402766 1.00000000 0.15311210 0.06112657
## FDis 0.92800700 0.4921640 0.15311210 1.00000000 0.06181254
## FD -0.06443103 0.2280246 0.06112657 0.06181254 1.00000000
ggcorrplot(cor_matrix,
method = "circle",
type = "lower",
lab = TRUE,
title = "Índices de Diversidade Funcional")
mod1 <- glmmTMB(log(meanFunction) ~ raoq + FRic + (1|Year),data = e120)
summary(mod1)
## Family: gaussian ( identity )
## Formula: log(meanFunction) ~ raoq + FRic + (1 | Year)
## Data: e120
##
## AIC BIC logLik deviance df.resid
## -162.7 -143.7 86.4 -172.7 324
##
## Random effects:
##
## Conditional model:
## Groups Name Variance Std.Dev.
## Year (Intercept) 4.157e-11 6.447e-06
## Residual 3.464e-02 1.861e-01
## Number of obs: 329, groups: Year, 2
##
## Dispersion estimate for gaussian family (sigma^2): 0.0346
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -9.540e-01 NaN NaN NaN
## raoq -4.476e-05 NaN NaN NaN
## FRic 1.757e-05 NaN NaN NaN
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal
outliers(mod_resid)
## [1] 5 40 179 234 278
ggplot(e120, aes(x = raoq, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 13 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 13 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(e120, aes(x = raoq, y = meanFunction, color = as.factor(Year))) +
geom_point() +
geom_smooth(aes(group = as.factor(Year)), method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 13 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 13 rows containing missing values or values outside the scale range
## (`geom_point()`).
#Tirando outliers
e120_semot <- e120 %>%
filter(!raoq >100) %>%
filter(!FRic >150)
mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|Year),data = e120_semot)
summary(mod1)
## Family: gaussian ( identity )
## Formula: meanFunction ~ raoq + FRic + (1 | Year)
## Data: e120_semot
##
## AIC BIC logLik deviance df.resid
## -738.8 -720.1 374.4 -748.8 304
##
## Random effects:
##
## Conditional model:
## Groups Name Variance Std.Dev.
## Year (Intercept) 5.229e-05 0.007231
## Residual 5.158e-03 0.071822
## Number of obs: 309, groups: Year, 2
##
## Dispersion estimate for gaussian family (sigma^2): 0.00516
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.3633017 0.0134503 27.011 < 2e-16 ***
## raoq 0.0017344 0.0004406 3.936 8.28e-05 ***
## FRic 0.0001262 0.0001487 0.849 0.396
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(e120_semot, aes(x = raoq, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 10 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(e120_semot, aes(x = raoq, y = meanFunction, color = as.factor(Year))) +
geom_point() +
geom_smooth(aes(group = as.factor(Year)), method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 10 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(e120_semot, aes(x = FRic, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "FRic",
x = "FRic", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 10 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(e120_semot, aes(x = FRic, y = meanFunction, color=as.factor(Year))) +
geom_point() +
geom_smooth(aes(group = as.factor(Year)), method = "lm", se = FALSE) +
labs(title = "FRic",
x = "FRic", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 10 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
Tratamento 1 - Sem história de solo e sem história de plantas: O solo e a camada de plantas foram removidos até 30 cm de profundidade e substituídos por solo de um campo arável adjacente. Tratamento 2 - Com história de solo, mas sem história de plantas: A camada de plantas foi removida, mas o solo original foi mantido. Tratamento 3 - Com história de solo e de plantas: As parcelas existentes do experimento principal, estabelecidas desde 2002, foram mantidas como controle de longo prazo, mantendo tanto a história do solo quanto a das plantas. Esses tratamentos foram projetados para testar como a história do solo e das plantas influenciam a produtividade vegetal e as interações ecológicas ao longo do tempo, considerando tanto a diversidade de plantas quanto os efeitos do histórico do solo sobre a biomassa e outros fatores ecológicos.
80 plots 3 tratamentos 3 anos
cobertura_2017 <- read.csv("dbef/PLANT_COVER_2017.csv", sep = ";")
cobertura_2018 <- read.csv("dbef/PLANT_COVER_2018.csv", sep = ";")
cobertura_2019 <- read.csv("dbef/PLANT_COVER_2019.csv", sep = ";")
cobertura_total <- bind_rows(cobertura_2017, cobertura_2018, cobertura_2019)
datatable(cobertura_total, options= list(deferRender = TRUE, scrollY = "350px", scrollX=T, scroller = TRUE, autoWidth=T), rownames=T)
## Warning in instance$preRenderHook(instance): It seems your data is too big for
## client-side DataTables. You may consider server-side processing:
## https://rstudio.github.io/DT/server.html
#diversidade funcional
fd_dbef <- dbFD(trait_dat_dbef, abundance_dbef_matrix_clean)
## FEVe: Could not be calculated for communities with <3 functionally singular species.
## FDis: Equals 0 in communities with only one functionally singular species.
## FRic: To respect s > t, FRic could not be calculated for communities with <3 functionally singular species.
## FRic: Dimensionality reduction was required. The last 57 PCoA axes (out of 59 in total) were removed.
## FRic: Quality of the reduced-space representation = 0.7574923
## FDiv: Could not be calculated for communities with <3 functionally singular species.
Functional_dbef <- data.frame(raoq = fd_dbef$RaoQ, FRic = fd_dbef$FRic,FEve = fd_dbef$FEve, FDis = fd_dbef$FDis, FD = fd_dbef$nbsp )
datatable(Functional_dbef, options= list(deferRender = TRUE, scrollY = "350px", scrollX=T, scroller = TRUE, autoWidth=T), rownames=T)
# Combinar os Dados com a Base
dados_combinados <- base %>%
left_join(cobertura_media, by = c("plot", "treatment", "year")) %>%
left_join(biomass_summary, by = c("plot", "treatment", "year")) %>%
left_join(atv_micro, by = c("plot", "treatment", "year")) %>%
left_join(herbivoria_total, by = c("plot", "treatment", "year")) %>%
left_join(predacao, by = c("plot", "treatment", "year"))
dbef_multifunc <- cbind(dados_combinados, getStdAndMeanFunctions(dados_combinados, func_vars))
dataset_final_JENA <- dbef_multifunc %>%
left_join(Functional_dbef, by = c("plot", "treatment", "year"))
datatable(dataset_final_JENA, options= list(deferRender = TRUE, scrollY = "350px", scrollX=T, scroller = TRUE, autoWidth=T), rownames=T)
cor_matrix
## raoq FRic FEve FDis FD
## raoq 1.0000000 0.55127018 0.33838727 0.9545245 0.4651809
## FRic 0.5512702 1.00000000 0.09063385 0.4986894 0.6718329
## FEve 0.3383873 0.09063385 1.00000000 0.3517603 0.2450418
## FDis 0.9545245 0.49868937 0.35176030 1.0000000 0.4626148
## FD 0.4651809 0.67183287 0.24504183 0.4626148 1.0000000
ggcorrplot(cor_matrix,
method = "circle",
type = "lower",
lab = TRUE,
title = "Índices de Diversidade Funcional")
mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|year),data = jena)
summary(mod1)
## Family: gaussian ( identity )
## Formula: meanFunction ~ raoq + FRic + (1 | year)
## Data: jena
##
## AIC BIC logLik deviance df.resid
## -1285.8 -1266.2 647.9 -1295.8 364
##
## Random effects:
##
## Conditional model:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.0008237 0.02870
## Residual 0.0016904 0.04111
## Number of obs: 369, groups: year, 3
##
## Dispersion estimate for gaussian family (sigma^2): 0.00169
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.125e-01 1.723e-02 12.334 < 2e-16 ***
## raoq -2.653e-04 1.732e-04 -1.532 0.125645
## FRic 1.402e-04 4.223e-05 3.319 0.000903 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal
outliers(mod_resid)
## [1] 363
ggplot(jena, aes(x = raoq, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 164 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 164 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(jena, aes(x = raoq, y = meanFunction, color = as.factor(year))) +
geom_point() +
geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 164 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 164 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(jena, aes(x = raoq, y = meanFunction, color = as.factor(year))) +
geom_point() +
geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 164 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 164 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(jena, aes(x = FRic, y = meanFunction, color = as.factor(year))) +
geom_point() +
geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
labs(title = "FRic",
x = "FRic", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 351 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 351 rows containing missing values or values outside the scale range
## (`geom_point()`).
#Tirando outliers
jena_semot <- jena %>%
filter(!raoq >75)
mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|year),data = jena_semot)
summary(mod1)
## Family: gaussian ( identity )
## Formula: meanFunction ~ raoq + FRic + (1 | year)
## Data: jena_semot
##
## AIC BIC logLik deviance df.resid
## -1281.6 -1262.0 645.8 -1291.6 363
##
## Random effects:
##
## Conditional model:
## Groups Name Variance Std.Dev.
## year (Intercept) 0.0008164 0.02857
## Residual 0.0016935 0.04115
## Number of obs: 368, groups: year, 3
##
## Dispersion estimate for gaussian family (sigma^2): 0.00169
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.118e-01 1.720e-02 12.311 < 2e-16 ***
## raoq -2.293e-04 1.840e-04 -1.247 0.21247
## FRic 1.375e-04 4.253e-05 3.232 0.00123 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(jena_semot, aes(x = raoq, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 160 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 160 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(jena_semot, aes(x = raoq, y = meanFunction, color = as.factor(year))) +
geom_point() +
geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
labs(title = "RAOQ",
x = "raoq", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 160 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 160 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(jena_semot, aes(x = FRic, y = meanFunction)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
labs(title = "FRic",
x = "FRic", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 347 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 347 rows containing missing values or values outside the scale range
## (`geom_point()`).
ggplot(jena_semot, aes(x = FRic, y = meanFunction, color=as.factor(year))) +
geom_point() +
geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
labs(title = "FRic",
x = "FRic", y = "meanFunction") +
theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 347 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 347 rows containing missing values or values outside the scale range
## (`geom_point()`).